﻿using System;
namespace Producers.Rr.Xtee.Riik.Ee.Producer.Rr {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="RR86Response", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR86Response))]
    public class RR86ResponseSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IRR86Response clazz;
        
        public RR86ResponseSerializer(IRR86Response clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("IsikuIsikukood");
            if (clazz.IsikuIsikukood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuIsikukood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuIsikukood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("IsikuEesnimi");
            if (clazz.IsikuEesnimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuEesnimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuEesnimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("IsikuPerenimi");
            if (clazz.IsikuPerenimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuPerenimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuPerenimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("IsikuStaatus");
            if (clazz.IsikuStaatus!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuStaatus))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuStaatus");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("IsikuTeovoime");
            if (clazz.IsikuTeovoime!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.IsikuTeovoime))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : IsikuTeovoime");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Veakood");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "integer");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdInteger(((decimal)(clazz.Veakood))).ToString());
            Writer.WriteEndElement();
            Writer.WriteStartElement("Veatekst");
            if (clazz.Veatekst!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Veatekst))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Veatekst");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Dokumendiandmed");
            if (clazz.Dokumendiandmed!=null) {
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute(">>>RR86Response>Dokumendiandmed>Dokumendiandmed", "http://producers.rr.xtee.riik.ee/producer/rr", clazz.Dokumendiandmed.Count);
                for (int x = 0; ((clazz.Dokumendiandmed != null) 
                            && (x < clazz.Dokumendiandmed.Count)); x = (x + 1)) {
                    if (clazz.Dokumendiandmed[x]!=null) {
                        Writer.WriteStartElement("Dokumendiandmed");
                        global::Xtee.Core.SerializationMetadata metaDokumendiandmed = this.GetMetaData(clazz.Dokumendiandmed[x]);
                        Writer.WriteTypeAttribute(metaDokumendiandmed.TypeQualifiedName.Namespace, metaDokumendiandmed.TypeQualifiedName.Name);
                        metaDokumendiandmed.NewSerializer(clazz.Dokumendiandmed[x]).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Dokumendiandmed");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("Suhe");
            if (clazz.Suhe!=null) {
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute(">>>RR86Response>Suhe>Suhe", "http://producers.rr.xtee.riik.ee/producer/rr", clazz.Suhe.Count);
                for (int x = 0; ((clazz.Suhe != null) 
                            && (x < clazz.Suhe.Count)); x = (x + 1)) {
                    if (clazz.Suhe[x]!=null) {
                        Writer.WriteStartElement("Suhe");
                        global::Xtee.Core.SerializationMetadata metaSuhe = this.GetMetaData(clazz.Suhe[x]);
                        Writer.WriteTypeAttribute(metaSuhe.TypeQualifiedName.Namespace, metaSuhe.TypeQualifiedName.Name);
                        metaSuhe.NewSerializer(clazz.Suhe[x]).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Suhe");
            }
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="IsikuIsikukood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR86Response>IsikuIsikukood");
                }
                clazz.IsikuIsikukood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("IsikuIsikukood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR86Response>IsikuIsikukood", Reader.LocalName);
            }
            if (Reader.LocalName=="IsikuEesnimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR86Response>IsikuEesnimi");
                }
                clazz.IsikuEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("IsikuEesnimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR86Response>IsikuEesnimi", Reader.LocalName);
            }
            if (Reader.LocalName=="IsikuPerenimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR86Response>IsikuPerenimi");
                }
                clazz.IsikuPerenimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("IsikuPerenimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR86Response>IsikuPerenimi", Reader.LocalName);
            }
            if (Reader.LocalName=="IsikuStaatus") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR86Response>IsikuStaatus");
                }
                clazz.IsikuStaatus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("IsikuStaatus")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR86Response>IsikuStaatus", Reader.LocalName);
            }
            if (Reader.LocalName=="IsikuTeovoime") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR86Response>IsikuTeovoime");
                }
                clazz.IsikuTeovoime = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("IsikuTeovoime")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR86Response>IsikuTeovoime", Reader.LocalName);
            }
            if (Reader.LocalName=="Veakood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR86Response>Veakood");
                }
                clazz.Veakood = new global::Xtee.Core.Schema.XsdInteger(Reader.ReadElementString("Veakood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR86Response>Veakood", Reader.LocalName);
            }
            if (Reader.LocalName=="Veatekst") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR86Response>Veatekst");
                }
                clazz.Veatekst = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Veatekst")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR86Response>Veatekst", Reader.LocalName);
            }
            if (Reader.LocalName=="Dokumendiandmed") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR86Response>Dokumendiandmed");
                }
                clazz.Dokumendiandmed = new System.Collections.Generic.List<RR86Response.IDokumendiandmedType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("Dokumendiandmed");
                    for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                && (Reader.LocalName == "Dokumendiandmed")); ) {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RR86Response>Dokumendiandmed>Dokumendiandmed");
                        }
                        global::Xtee.Core.SerializationMetadata metaDokumendiandmed = this.GetMetaData<RR86Response.IDokumendiandmedType>(Reader, ">>>RR86Response>Dokumendiandmed>Dokumendiandmed", "http://producers.rr.xtee.riik.ee/producer/rr");
                        RR86Response.IDokumendiandmedType item = metaDokumendiandmed.NewEntity<RR86Response.IDokumendiandmedType>();
                        clazz.Dokumendiandmed.Add(item);
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("Dokumendiandmed");
                            metaDokumendiandmed.NewSerializer(item).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR86Response>Dokumendiandmed", Reader.LocalName);
            }
            if (Reader.LocalName=="Suhe") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR86Response>Suhe");
                }
                clazz.Suhe = new System.Collections.Generic.List<RR86Response.ISuheType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("Suhe");
                    for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                && (Reader.LocalName == "Suhe")); ) {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RR86Response>Suhe>Suhe");
                        }
                        global::Xtee.Core.SerializationMetadata metaSuhe = this.GetMetaData<RR86Response.ISuheType>(Reader, ">>>RR86Response>Suhe>Suhe", "http://producers.rr.xtee.riik.ee/producer/rr");
                        RR86Response.ISuheType item = metaSuhe.NewEntity<RR86Response.ISuheType>();
                        clazz.Suhe.Add(item);
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("Suhe");
                            metaSuhe.NewSerializer(item).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR86Response>Suhe", Reader.LocalName);
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>RR86Response>Dokumendiandmed>Dokumendiandmed", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR86Response.DokumendiandmedType))]
        public class DokumendiandmedTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected RR86Response.IDokumendiandmedType clazz;
            
            public DokumendiandmedTypeSerializer(RR86Response.IDokumendiandmedType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("Dokumendiandmed.Kood");
                if (clazz.DokumendiandmedKood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedKood))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedKood");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.Nimetus");
                if (clazz.DokumendiandmedNimetus!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedNimetus))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedNimetus");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.Seeria");
                if (clazz.DokumendiandmedSeeria!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedSeeria))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedSeeria");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.Number");
                if (clazz.DokumendiandmedNumber!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedNumber))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedNumber");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.DokStaatus");
                if (clazz.DokumendiandmedDokStaatus!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedDokStaatus))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedDokStaatus");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.Asutus");
                if (clazz.DokumendiandmedAsutus!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedAsutus))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedAsutus");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.DokValjastamisKuup");
                if (clazz.DokumendiandmedDokValjastamisKuup!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedDokValjastamisKuup))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedDokValjastamisKuup");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.KehtivAlates");
                if (clazz.DokumendiandmedKehtivAlates!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedKehtivAlates))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedKehtivAlates");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.KehtivKuni");
                if (clazz.DokumendiandmedKehtivKuni!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedKehtivKuni))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedKehtivKuni");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.DokIsikukood");
                if (clazz.DokumendiandmedDokIsikukood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedDokIsikukood))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedDokIsikukood");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.DokPerekonnanimi");
                if (clazz.DokumendiandmedDokPerekonnanimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedDokPerekonnanimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedDokPerekonnanimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.DokEesnimi");
                if (clazz.DokumendiandmedDokEesnimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedDokEesnimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedDokEesnimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Dokumendiandmed.Dok_osalus");
                if (clazz.DokumendiandmedDokOsalus!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.DokumendiandmedDokOsalus))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : DokumendiandmedDokOsalus");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
                if (Reader.LocalName=="Dokumendiandmed.Kood") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Kood");
                    }
                    clazz.DokumendiandmedKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.Kood")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Kood", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.Nimetus") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Nimetus");
                    }
                    clazz.DokumendiandmedNimetus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.Nimetus")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Nimetus", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.Seeria") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Seeria");
                    }
                    clazz.DokumendiandmedSeeria = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.Seeria")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Seeria", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.Number") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Number");
                    }
                    clazz.DokumendiandmedNumber = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.Number")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Number", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.DokStaatus") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.DokStaatus");
                    }
                    clazz.DokumendiandmedDokStaatus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.DokStaatus")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.DokStaatus", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.Asutus") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Asutus");
                    }
                    clazz.DokumendiandmedAsutus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.Asutus")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Asutus", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.DokValjastamisKuup") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.DokValjastamisKu" +
                                "up");
                    }
                    clazz.DokumendiandmedDokValjastamisKuup = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.DokValjastamisKuup")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.DokValjastamisKu" +
                            "up", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.KehtivAlates") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.KehtivAlates");
                    }
                    clazz.DokumendiandmedKehtivAlates = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.KehtivAlates")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.KehtivAlates", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.KehtivKuni") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.KehtivKuni");
                    }
                    clazz.DokumendiandmedKehtivKuni = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.KehtivKuni")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.KehtivKuni", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.DokIsikukood") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.DokIsikukood");
                    }
                    clazz.DokumendiandmedDokIsikukood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.DokIsikukood")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.DokIsikukood", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.DokPerekonnanimi") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.DokPerekonnanimi" +
                                "");
                    }
                    clazz.DokumendiandmedDokPerekonnanimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.DokPerekonnanimi")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.DokPerekonnanimi" +
                            "", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.DokEesnimi") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.DokEesnimi");
                    }
                    clazz.DokumendiandmedDokEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.DokEesnimi")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.DokEesnimi", Reader.LocalName);
                }
                if (Reader.LocalName=="Dokumendiandmed.Dok_osalus") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Dok_osalus");
                    }
                    clazz.DokumendiandmedDokOsalus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Dokumendiandmed.Dok_osalus")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Dokumendiandmed>Dokumendiandmed>Dokumendiandmed.Dok_osalus", Reader.LocalName);
                }
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>RR86Response>Suhe>Suhe", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR86Response.SuheType))]
        public class SuheTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected RR86Response.ISuheType clazz;
            
            public SuheTypeSerializer(RR86Response.ISuheType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("Suhe.Suhtetyyp");
                if (clazz.SuheSuhtetyyp!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SuheSuhtetyyp))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SuheSuhtetyyp");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Suhe.Isikukood");
                if (clazz.SuheIsikukood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SuheIsikukood))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SuheIsikukood");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Suhe.Perenimi");
                if (clazz.SuhePerenimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SuhePerenimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SuhePerenimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Suhe.Eesnimi");
                if (clazz.SuheEesnimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SuheEesnimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SuheEesnimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Suhe.IsikuStaatus");
                if (clazz.SuheIsikuStaatus!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SuheIsikuStaatus))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SuheIsikuStaatus");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Suhe.IsikuTeovoime");
                if (clazz.SuheIsikuTeovoime!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SuheIsikuTeovoime))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SuheIsikuTeovoime");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("Suhe.Alguskp");
                if (clazz.SuheAlguskp!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.SuheAlguskp))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SuheAlguskp");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
                if (Reader.LocalName=="Suhe.Suhtetyyp") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Suhe>Suhe>Suhe.Suhtetyyp");
                    }
                    clazz.SuheSuhtetyyp = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Suhe.Suhtetyyp")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Suhe>Suhe>Suhe.Suhtetyyp", Reader.LocalName);
                }
                if (Reader.LocalName=="Suhe.Isikukood") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Suhe>Suhe>Suhe.Isikukood");
                    }
                    clazz.SuheIsikukood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Suhe.Isikukood")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Suhe>Suhe>Suhe.Isikukood", Reader.LocalName);
                }
                if (Reader.LocalName=="Suhe.Perenimi") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Suhe>Suhe>Suhe.Perenimi");
                    }
                    clazz.SuhePerenimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Suhe.Perenimi")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Suhe>Suhe>Suhe.Perenimi", Reader.LocalName);
                }
                if (Reader.LocalName=="Suhe.Eesnimi") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Suhe>Suhe>Suhe.Eesnimi");
                    }
                    clazz.SuheEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Suhe.Eesnimi")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Suhe>Suhe>Suhe.Eesnimi", Reader.LocalName);
                }
                if (Reader.LocalName=="Suhe.IsikuStaatus") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Suhe>Suhe>Suhe.IsikuStaatus");
                    }
                    clazz.SuheIsikuStaatus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Suhe.IsikuStaatus")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Suhe>Suhe>Suhe.IsikuStaatus", Reader.LocalName);
                }
                if (Reader.LocalName=="Suhe.IsikuTeovoime") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Suhe>Suhe>Suhe.IsikuTeovoime");
                    }
                    clazz.SuheIsikuTeovoime = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Suhe.IsikuTeovoime")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Suhe>Suhe>Suhe.IsikuTeovoime", Reader.LocalName);
                }
                if (Reader.LocalName=="Suhe.Alguskp") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR86Response>Suhe>Suhe>Suhe.Alguskp");
                    }
                    clazz.SuheAlguskp = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("Suhe.Alguskp")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR86Response>Suhe>Suhe>Suhe.Alguskp", Reader.LocalName);
                }
            }
        }
    }
}
